package com.chinawayltd.ews.sample.job;

import com.chinawayltd.ews.sample.service.DispatchAlgorithmService;
import com.chinawayltd.ews.sample.taskCenter.TaskJob;
import org.quartz.JobExecutionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @program: greeProject.timingTaskCenter
 * @description:获取任务调度算法执行结果定时器
 * @author: xiazj
 * @create: 2018-05-10 11:40
 **/
@Component
public class DispatchAlgorithmJob implements TaskJob {

    private static Logger logger = LoggerFactory.getLogger(DispatchAlgorithmJob.class);

    @Autowired
    protected DispatchAlgorithmService dispatchAlgorithmService;

    @Override
    public void doJob(JobExecutionContext context) {
        try {
            dispatchAlgorithmService.checkAndLogRunStatus();
        }catch(Exception e) {
            logger.error("智能调度算法执行情况定时任务执行时发生错误！", e);
        }
    }

}
